local millis=tonumber(ARGV[3])
redis.call("ZREMRANGEBYSCORE",KEYS[1],0,millis-tonumber(ARGV[4]))
if redis.call("ZCARD",KEYS[1])>=tonumber(ARGV[2]) then
    return 0
end
redis.call("ZADD",KEYS[1],millis,ARGV[1])
return 1